package ch9_9_3;
public class Account{
	private int id;
	private double balance;
	private double annualInterestRate;
	private java.util.Date dateCreated;
	
	/** A no-arg constructor that creates a default account */
	protected Account(){
		id=0;
		balance=0.0;
		annualInterestRate=0.0;
		dateCreated=new java.util.Date();
	}
	
	/** set id */
	public void setID(int id){
		this.id = id;
	}
	
	/** return id */
	public int getID(){
		return id;
	}
	
	/** set balance */
	public void setBalance(double balance){
		this.balance = balance;
	}
	
	/** return balance */
	public double getBalance(){
		return balance;
	}
	
	/** set annual interest rate */
	public void setAnnualInterestRate(double annualInterestRate){
		this.annualInterestRate = annualInterestRate;
	}
	
	/** return annual interest rate */
	public double getAnnualInterestRate(){
		return annualInterestRate;
	}
	
	/** return dateCreated */
	public java.util.Date getDateCreated(){
		return dateCreated;
	}
	
	/** return monthly interest rate */
	public double getMonthlyInterestRate(){
		return annualInterestRate/12;
	}
	
	/** withdraw a specific amount from the account */
	public void withDraw(double withDrawAmount){
		balance -= withDrawAmount;
	}
	
	/** deposit a specific amount to the account */
	public void deposit(double depositAmount){
		balance += depositAmount;
	}
	
	/** return a string representation of this object */
	public String toString(){
		return "Account: create on "+dateCreated+
				",id="+id+",balance="+balance+
				",annualInterestRate="+annualInterestRate+".";
	}
}
